from tortoise import fields
from tortoise.models import Model


class History(Model):
    id = fields.IntField(pk=True)
    content = fields.JSONField()
    created_time=fields.DatetimeField(auto_now_add=True)
    updated_time=fields.DatetimeField(auto_now=True)

    class Meta:
        table = "history"

class Session(Model):
    id = fields.IntField(pk=True)
    created_time=fields.DatetimeField(auto_now_add=True)
    updated_time=fields.DatetimeField(auto_now=True)

    class Meta:
        table = "session"

class SessionAndHistory(Model):
    id = fields.IntField(pk=True)
    session_id = fields.IntField()
    history_id = fields.IntField()
    created_time=fields.DatetimeField(auto_now_add=True)
    updated_time=fields.DatetimeField(auto_now=True)

    class Meta:
        table = "session_and_history"